package com.sdcx.agrobank.dialog;

import android.app.Dialog;
import android.content.Context;
import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

import com.sdcx.agrobank.R;


public class ChangeSexDia extends Dialog implements View.OnClickListener {

    private Context mContext;
    private LinearLayout wechat, alipay;
    private ImageView finish;
    private onClickListener mOnClickListener;

    public ChangeSexDia(@NonNull Context context) {
        super(context);
        this.mContext = context;
    }

    public ChangeSexDia(@NonNull Context context, int themeResId) {
        super(context, themeResId);
        this.mContext = context;
    }

    protected ChangeSexDia(@NonNull Context context, boolean cancelable, @Nullable OnCancelListener cancelListener) {
        super(context, cancelable, cancelListener);
        this.mContext = context;
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.change_layout);
        //初始化界面控件
        initView();
    }

    private void initView() {

        wechat = (LinearLayout) findViewById(R.id.dia_pay_wechat);
        wechat.setOnClickListener(this);
        alipay = (LinearLayout) findViewById(R.id.dia_pay_alipay);
        alipay.setOnClickListener(this);

    }

    @Override
    public void onClick(View view) {
        switch (view.getId()) {
            case R.id.dia_pay_wechat:
                mOnClickListener.onItemClickListener(1);
                dismiss();
                break;
            case R.id.dia_pay_alipay:
                mOnClickListener.onItemClickListener(2);
                dismiss();
                break;
        }
    }

    public interface onClickListener {
        void onItemClickListener(int type);
    }

    public void setOnClickListener(onClickListener clickListener) {
        this.mOnClickListener = clickListener;
    }
}
